﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using Spring.Context.Support;

namespace Ld.Host.Server
{
    public partial class LdService : ServiceBase
    {
        private static log4net.ILog logger = log4net.LogManager.GetLogger("LogFileAppender");

        public LdService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            try
            {
                ContextRegistry.GetContext();
                System.Console.WriteLine("服务器已启动");
                logger.Debug("服务器已启动");
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.ToString());
                logger.Error(ex);
            }
        }

        protected override void OnStop()
        {
            System.Console.WriteLine("服务器已停止");
        }
    }
}
